# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=libpg_query
# Keep in mind the aport ruby-pg_query when bumping.
pkgver=13.2.1.1
_pkgver=${pkgver/./-}
pkgrel=0
pkgdesc="C library for accessing the PostgreSQL parser outside of the server"
url="https://github.com/pganalyze/libpg_query"
# riscv64 broken, "unknown type name 'slock_t'"
arch="all !riscv64"
license="BSD-3-Clause"
makedepends="protobuf-c-dev xxhash-dev"
subpackages="$pkgname-dbg $pkgname-dev"
source="https://github.com/pganalyze/libpg_query/archive/$_pkgver/$pkgname-$_pkgver.tar.gz
	dont-override-opt-level.patch
	verbose-build.patch
	unbundle-vendor-deps.patch
	"
builddir="$srcdir/$pkgname-$_pkgver"

prepare() {
	default_prepare

	# Remove vendored libraries.
	rm -Rf vendor
}

build() {
	make build build_shared
}

check() {
	make test
}

package() {
	make install DESTDIR="$pkgdir" prefix=/usr
}

sha512sums="
71901f2758b6a478382ef2a92bd6e27e7959398565ff99de2a8cb0c02a7b0ccd743aec0e61c7d03de315b08afee2c29bff61922a4b98a7f1aa1ec1445913d6de  libpg_query-13-2.1.1.tar.gz
96f63868507eb0612b98bb5ddc36f9ae30b35b805624576c5043fbc2276744f6a63a14d3d7349488b02516e729f8f98a7c7b40855a7555f350defad2191e482b  dont-override-opt-level.patch
f85cd8b29a65b3cc4670e5c769d8c4bc6b0b321a86ee4b41c3a24f634f7778ab4b001e676abed616cc02ba4be7b8d9a0e58e32c698f8c1db80ba0484d290310d  verbose-build.patch
d74fbd15e54250cd9a70a291d6d7ee5d5630ac9efcdb342efbd4938b47aa8941a87f310bfe3084ebba5ef2d359a8f81df589fe0025ad60b9c7feb26fb5a85097  unbundle-vendor-deps.patch
"
